﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EIIS.FrameWork.DomainModel;
using EIIS.FrameWork;
using EIIS.FrameWork.Attributes;


namespace EIIS.Infrastructure.Model.System.Authority
{
    public class Role :Entity
    {
        private string name;
        private string code;

        /// <summary>
        /// 角色名称
        /// </summary>
        public virtual string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                this.name = value;
            }
        }
        /// <summary>
        /// 代码
        /// </summary>
        public virtual string Code
        {
            get
            {
                return this.code;
            }
            set
            {
                this.code = value;
            }
        }

        public virtual string Description { get; set; }

        /// <summary>
        /// 角色状态
        /// </summary>
        public virtual RoleState State { get; set; }
        /// <summary>
        /// 角色下的用户
        /// </summary>
        public virtual Iesi.Collections.Generic.ISet<Person> Persons { get; set; }

        /// <summary>
        /// 角色拥有的菜单权限
        /// </summary>
        public virtual Iesi.Collections.Generic.ISet<MenuNode> MenuNodes { get; set; }

        /// <summary>
        /// 角色拥有的功能权限
        /// </summary>
        public virtual Iesi.Collections.Generic.ISet<ActionPermission> ActionPermissions { get; set; }
    }

    /// <summary>
    /// 角色状态
    /// </summary>
    public enum RoleState
    {
        [EnumDescription("正常")]
        Normal = 0,

        [EnumDescription("停用")]
        Disabled = 1
    }
}
